import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import VueSetupExtend from 'vite-plugin-vue-setup-extend';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
// import tailwindcss from '@tailwindcss/vite/dist/index.mjs'
export default defineConfig({
	base: './',
	plugins: [
		vue(),
		VueSetupExtend(),
		// tailwindcss(),

		AutoImport({
			resolvers: [ElementPlusResolver()]
		}),
		Components({
			resolvers: [ElementPlusResolver()]
		}),
	],
	optimizeDeps: {
		include: ['schart.js']
	},
	resolve: {
		alias: {
			'@': '/src',
			'~': '/src/assets'
		}
	},
	define: {
		__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
	},
	server: {
		host:'0.0.0.0',
		proxy: {
		 	'/api': {
			target: 'https://test.gopathdigital.com',
			changeOrigin: true,
			secure: false,  // 如果目标是 https 并使用自签名证书，可以将 secure 设置为 false
        	rewrite: (path) => path.replace(/^\/api/, '/'),  // 重写路径：将请求中的 `/uti` 部分去掉
		  }
		}
	  }
});
